<?php

class Default_Model_DbTable_ProductOption extends Zend_Db_Table_Abstract
{

    protected $_name = 'product_option';

    public function getAllProduct(){
    	return $this->fetchAll();
    }
    
    public function getProductOptByID($proOptID){
    	return $this->fetchRow("product_opt_id = $proOptID");
    }
    
    public function getProductOptByProductID($proID){
    	$select = $this->select()
    	->from($this->_name)
    	->where("product_id = $proID");
    	return $this->fetchAll($select);
    }
    
    public function addNewProductOPt($proID,$proKey,$desc,$price){
    	$dataOption = array(
    			"product_id"=>$proID,
    			"product_key"=>$proKey,
    			"description"=>$desc,
    			"price"=>$price
    			);
    	return $this->insert($dataOption);
    }
    
    public function updateOption($pro_opt_id,$proID,$proKey,$desc,$price){
    	$dataOption = array(
    			"product_id"=>$proID,
    			"product_key"=>$proKey,
    			"description"=>$desc,
    			"price"=>$price
    			);
    	return $this->update($dataOption, "product_opt_id = $pro_opt_id");
    }
    
}

